package leetcode.code0367;

public class Solution extends Solution367 {

	@Override
	public boolean isPerfectSquare(int num) {
		int sub = 1;
		while (num > 0) {
			num -= sub;
			sub += 2;
		}
		return num == 0;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug4();
		so.debug3();
		so.debug1();
		so.debug2();
//		System.out.println(so.isPerfectSquare(255));
//		System.out.println(so.isPerfectSquare(256));
//		System.out.println(so.isPerfectSquare(1024));
//		System.out.println(so.isPerfectSquare(1025));
//		System.out.println(Math.sqrt(255));
	}

}
